package com.ledim.bean;

import com.google.gson.annotations.Expose;
import java.io.Serializable;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Unique;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import com.ledim.db.dao.DaoSession;
import com.ledim.db.dao.LedimSearchRecordDao;

@Entity(
        //  实体是否激活的标志，激活的实体有更新，删除和刷新的方法
        active = true,
        // 确定数据库中表的名称
        // 表名称默认是实体类的名称
        nameInDb = "SEARCH_RECORD")
public class LedimSearchRecord implements Serializable {

    @Property(nameInDb = "Id")
    @Id(autoincrement = true)
    private Long id;

    @Unique
    @Property(nameInDb = "keyword")
    public String keyword;

    @Property(nameInDb = "time")
    public long time;

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /** Used for active entity operations. */
    @Generated(hash = 1677460731)
    private transient LedimSearchRecordDao myDao;

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    public long getTime() {
        return this.time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public String getKeyword() {
        return this.keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 2144168822)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getLedimSearchRecordDao() : null;
    }

    @Generated(hash = 2040511328)
    public LedimSearchRecord(Long id, String keyword, long time) {
        this.id = id;
        this.keyword = keyword;
        this.time = time;
    }

    @Generated(hash = 1800595562)
    public LedimSearchRecord() {
    }

}
